package com.boot.security.server.dao.mffl;

import java.util.List;
import java.util.Map;

import com.boot.security.server.model.mffl.Vo.MfflLwyerPersonalServiceVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.boot.security.server.model.mffl.MfflLwyerPersonalService;

@Mapper
public interface MfflLwyerPersonalServiceDao {

    @Select("select * from mffl_lwyer_personal_service t where t.id = #{id}")
    MfflLwyerPersonalService getById(Long id);

    @Delete("delete from mffl_lwyer_personal_service where id = #{id}")
    int delete(Long id);

    int update(MfflLwyerPersonalService mfflLwyerPersonalService);

    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into mffl_lwyer_personal_service(serverId, typeId, money, free_apply_time, createTime, updateTime, lawyerId, `order`, company) values(#{serverId}, #{typeId}, #{money}, #{freeApplyTime}, now(),now(), #{lawyerId}, #{order}, #{company})")
    int save(MfflLwyerPersonalService mfflLwyerPersonalService);
    
    int count(@Param("params") Map<String, Object> params);

    List<MfflLwyerPersonalService> list(@Param("params") Map<String, Object> params, @Param("offset") Integer offset, @Param("limit") Integer limit);

    List<MfflLwyerPersonalServiceVo> getLawyerServiceListByLaeyerId(@Param("lawyerId") Integer lawyerId);

    //获取律师对应的收费情况
    @Select("select * from mffl_lwyer_personal_service t where t.lawyerId = #{lawyerId} AND t.serverId = #{serverId}")
    MfflLwyerPersonalService getLawyerServiceMoney(@Param("lawyerId") Integer lawyerId,@Param("serverId") Integer serviceId);
}
